package com.gmail.wangzdl.swing.splashtest;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/*
 * ProgressDemo.java
 *
 * Created on 2007��4��27��, ����6:02
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author William Chen
 */
public class ProgressDemo {
    
    /** Creates a new instance of ProgressDemo */
    public ProgressDemo() {
    }
    public static void main(String[]args){
        //Set System Look And Feel
        try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());} catch (Exception ex){}
        //New an instance of the progress panel.
        SplashPanel panel=new SplashPanel();
        //Encapsulate the panel into splash manager.
        SplashManager manager=new SplashManager(panel);
        //Set some indication message.
        panel.setMessage("Start to download updating...");
        //Note every time you update panel, you have to manually call SplashManager.repaint to update the screen.
        manager.repaint();
        for(int i=0;i<100;i++){
            //Do some time-consuming work and signal the progress to splash manager.
            panel.setProgress(i);
            //Note every time you update panel, you have to manually call SplashManager.repaint to update the screen.
            manager.repaint();
            try{Thread.sleep(100);}catch(Exception e){}
        }
        manager.closeSplash();
        start_application();
    }
    
    private static void start_application() {
        //Start your application here.
    }
}
